Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(samsung_pay): populate payment_method_data in the payment response #7095

Merged
merged 5 commits into from
Feb 3, 2025

Conversation

ShankarSinghC
Copy link
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This pr contains the changes to populate payment_method_data in the samsung pay payment response. As part of this card_type is made a optional for wallet payment_method_data as samsung pay does not send credit or debit in the samsung pay token.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Having payment_method_data for Samsung Pay would be helpful in identifying the customer's card, as it contains the last four digits during a wallet payment.

How did you test it?

-> Create a connector with samsung pay enabled
-> Make a samsung pay payment, payment_method_data would be populated in the resposne.

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <api-key>' \
--data-raw '{
    "amount": 1,
    "currency": "USD",
    "confirm": true,
    "business_country": "US",
    "business_label": "default",
    "amount_to_capture": 1,
    "customer_id": "cu_1737628105",
    "setup_future_usage": "off_session",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "return_url": "https://google.com",
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "payment_method": "wallet",
    "payment_method_type": "samsung_pay",
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        }
    },
    "payment_method_data": {
        "wallet": {
            "samsung_pay": {
                "payment_credential": {
                    "3_d_s": {
                        "type": "S",
                        "version": "100",
                        "data": ""
                    },
                    "payment_card_brand": "VI",
                    "payment_currency_type": "USD",
                    "payment_last4_fpan": "1661",
                    "method": "3DS",
                    "recurring_payment": false
                }
            }
        }
    }
}
'
{
    "payment_id": "pay_JfvIOAfcN2hhbntSD4Wl",
    "merchant_id": "merchant_1737542123",
    "status": "processing",
    "amount": 1,
    "net_amount": 1,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": null,
    "connector": "cybersource",
    "client_secret": "pay_JfvIOAfcN2hhbntSD4Wl_secret_XQLmNkq4plkpVOnRJ4Tj",
    "created": "2025-01-23T08:14:47.701Z",
    "currency": "USD",
    "customer_id": "cu_1737620088",
    "customer": {
        "id": "cu_1737620088",
        "name": "Joseph Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "samsung_pay": {
                "last4": "1661",
                "card_network": "Visa",
                "type": null
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+91"
        },
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "Joseph Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "Juspay",
    "statement_descriptor_suffix": "Router",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "samsung_pay",
    "connector_label": "cybersource_US_default_default",
    "business_country": "US",
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "cu_1737620088",
        "created_at": 1737620087,
        "expires": 1737623687,
        "secret": "epk_7b4a3abd8dd549c9a62694843d1f34b4"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7376200888906816004807",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "7376200888906816004807",
    "payment_link": null,
    "profile_id": "pro_ufywYBbtUhSFzOf1cGEM",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_27p7IwQqrL6FogXi41pr",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-01-23T08:29:47.701Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-01-23T08:14:49.229Z",
    "split_payments": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@ShankarSinghC ShankarSinghC added C-bug Category: Bug A-payment-methods Area: Payment Methods labels Jan 23, 2025
@ShankarSinghC ShankarSinghC self-assigned this Jan 23, 2025
@ShankarSinghC ShankarSinghC requested review from a team as code owners January 23, 2025 10:29
Copy link

semanticdiff-com bot commented Jan 23, 2025

@ShankarSinghC ShankarSinghC linked an issue Jan 23, 2025 that may be closed by this pull request
kashif-m
kashif-m previously approved these changes Jan 23, 2025
kashif-m
kashif-m previously approved these changes Jan 23, 2025
@hyperswitch-bot hyperswitch-bot bot added the M-api-contract-changes Metadata: This PR involves API contract changes label Jan 23, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jan 27, 2025
@Gnanasundari24 Gnanasundari24 removed this pull request from the merge queue due to a manual request Jan 27, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 31, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 31, 2025
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Feb 3, 2025
Merged via the queue into main with commit 04a5e38 Feb 3, 2025
18 of 21 checks passed
@Gnanasundari24 Gnanasundari24 deleted the samsung-pay/fix-resposne branch February 3, 2025 21:50
pixincreate added a commit that referenced this pull request Feb 4, 2025
…-connectors

* 'main' of github.com:juspay/hyperswitch:
  ci: disable stripe in cypress (#7183)
  fix(router): [Cybersource] add flag to indicate final capture  (#7085)
  fix: invalidate surcharge cache during update (#6907)
  chore(version): 2025.02.04.0
  fix(samsung_pay): populate `payment_method_data` in the payment response (#7095)
  feat(router): add core changes for external authentication flow through unified_authentication_service (#7063)
  fix(connector): [NETCETERA] add `sdk-type` and `default-sdk-type` in netcetera authentication request (#7156)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-payment-methods Area: Payment Methods C-bug Category: Bug M-api-contract-changes Metadata: This PR involves API contract changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

populate payment_method_data in the samsung pay payment response
4 participants